<!DOCTYPE html>
<html lang="zh-cn">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../assets/swiper/css/swiper.min.css">
    <style>
        body {
            padding-bottom: 800px;
            padding-left: 30px;
        }
        .swiper-container{
            width: 500px;
            height: 300px;
            border: 1px solid black;
        }
        .swiper-container img{
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
    </style>
</head>

<body>
    <div id="app">

        <div class="swiper-container" ref="loop">
            <div class="swiper-wrapper">
                <div class="swiper-slide" v-for="item in list">
                    <img :src="`https://oa.itany.com/itmupload/${item.annex.path}`" alt="" srcset="">
                </div>
            </div>
        </div>

    </div>
    <script src="../assets/swiper/js/swiper.js"></script>
    <script type="module">
        import axios from "../assets/axios-es/axios.js";
        // 加载 Vue3 的ESM 模块文件
        import { createApp } from "../assets/vue3/vue.esm-browser.js"
        createApp({
            data() {
                return {
                    list:[]
                }
            },
            methods: {
                async loadLoopData() {
                    let { data } = await axios.get("https://oa.itany.com/ItanyManager/web/findRotation",{
                        params:{
                            type:1,
                            sortid:1
                        }
                    })
                    this.list = data.data
                    await this.$nextTick()
                    new Swiper(this.$refs.loop,{})
                }
            },
            created () {
                this.loadLoopData();
                // console.log(this.$refs.loop);
                // this.$nextTick(()=>{
                //     // 当nextTick在created生命周期中被调用时，回调会延迟到DOM更新完成后加载
                //     // 相当于开启一个等待的回调方法，该方法会在实例对应的DOM容器完成挂载后的updated生命周期时间点上完成一次更新调用
                //     // 不兼容SSR的
                //     console.log(this.$refs.loop);
                // })
            },
            // mounted () {
            //     this.loadLoopData();
            // },
        }).mount("#app")
    </script>
</body>

</html>